//
//  TextUnitTableView.m
//
//
//  Created by gynjobs on 2017/8/14.
//  Copyright © 2017年 gynjobs. All rights reserved.
//

#import "TextUnitTableView.h"

@implementation TextUnitTableView

-(instancetype)init{
    
    if(self = [super initWithId:TEXT_UNIT_CELL_ID]){
        
        self.unitLabel = [[UILabel alloc] init];
        self.unitLabel.textColor = [UIColor colorWithString:UI_COLOR_COMMON_TEXT_COLOR_2];
        self.unitLabel.font = [UIFont systemFontOfSize:UI_FOND_HOME_CREDIT_CELL_MAIN_1];
        
        [self addSubview:self.unitLabel];
        
        [self updateConstraintsIfNeeded];
    }
    
    return self;
}

-(void)updateConstraints{
    
    [super updateConstraints];
    [self.unitLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.mas_equalTo(self.mas_centerY);
        make.right.equalTo(self.mas_right).with.offset(-LEFT_RIGHT_SPACE);
        
    }];
    
    [self.contentTextfield mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(titleLabel.mas_right).with.offset(LEFT_RIGHT_SPACE);
        make.right.equalTo(self.mas_right).with.offset(-LEFT_RIGHT_SPACE * 2 - INDICATOR_VIEW_WIDTH);
        make.centerY.equalTo(self.mas_centerY);
        make.height.mas_equalTo(CONTENT_TEXTFIELD_HEIGHT);
        
    }];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
